package com.burgeon.backend.SHOPBACKEND.service.Impl;

import com.burgeon.backend.SHOPBACKEND.entity.MailType;

import com.burgeon.backend.SHOPBACKEND.mappers.BackendSystemMapper;
import com.burgeon.backend.SHOPBACKEND.service.BackendSystemService;
import com.burgeon.backend.service.ex.ErrorDataException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Service
public class BackendSystemServiceImpl implements BackendSystemService {
    @Autowired
    private BackendSystemMapper backendSystemMapper;

    @Override
    public void tryApply(String name, String phone, String corporation) throws ErrorDataException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd" + " " + "HH:mm:ss");
        backendSystemMapper.createtryApply(name,phone,corporation,sdf.format(new Date()));
    }

    @Override
    public List<String> mainImg() {
        return backendSystemMapper.mainImg();
    }

    @Override
    public String getMapKey(String token) {

        return backendSystemMapper.getMapKey(token);
    }

    @Override
    public void upMailType(MailType mailType) {
        backendSystemMapper.upMailType(mailType);
    }

    @Override
    public void delMailType(String id) {
        backendSystemMapper.delMailType(id);
    }

    @Override
    public void createMailType(MailType mailType) {
        backendSystemMapper.createMaulType(mailType);
    }

    @Override
    public List<MailType> getMailType(String account) {
        return backendSystemMapper.getMailData(account);
    }
}
